package com.tic.robot.ui.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

/**
 * 描述:点击自动变70%的不透明度
 *
 * @author jakechen
 * @since 2016/8/16 17:50
 */
public class PressTextView extends TextView {
    public PressTextView(Context context) {
        super(context);
    }

    public PressTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public PressTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void drawableStateChanged() {
        super.drawableStateChanged();
        setAlpha((isPressed() || isFocused()) ? 0.7f : 1.0f);
    }
}
